import formBuilder from "@/comps/form/formBuilder";
import api from "@/pages/v1/auth/Page/js/api";

export default function () {
    let fb = formBuilder()
    fb.setLabelWidth(100)

    fb.addCascade("parentId").setLabel("上级菜单").setSpan(3)
        .setApi(api.urlTree)

    fb.addText("name").setSpan(6).setLabel("页面名称")
        .setRules([fb.R.notNull("名称不能为空")])

    fb.addText("appId").setSpan(3).setLabel("AppId").setMaxLength(16)
        .setRules([fb.R.notNull("AppId不能为空")])

    fb.addRadio("type").setLabel("类型").setSpan(3)
        .addChoice("页面","page")
        .addChoice("功能","func")
        .setRules([fb.R.notNull("AppId不能为空")])

    fb.addText("route").setSpan(9).setLabel("路由/KEY").setMaxLength(16)
        .setRules([fb.R.notNull("路由/KEY不能为空")])
        .setTips("路由以/开头，KEY只能包含字母和.")

    fb.addText("sort").setSpan(3).setLabel("排序").setTypeNumber()

    return fb
}